Generators convert mechanical energy to electrical energy.
As you can see in the diagram above, the turbine is spun be an external force. This causes the generator to spin and generates electricity.
Turbines have angled blades on the called vanes.
These turbines are usually turned by steam, water or wind.
The Turbine is connected to a generator which converts the movement from the turbine into electrical energy.
The process of converting mechanical energy to electrical is complex.
Click here for more info on how generators work